package com.book.core.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

import com.book.core.mode.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.*;

/**
 * 图书借阅记录
 *
 * @TableName borrow_records
 */
@TableName(value = "borrow_records")
@Data
public class BorrowRecords implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    @NotNull(message = "借阅记录编号不能为空", groups = {UpdateGroup.class})
    private Long recordId;
    /**
     * 图书编号
     */
    @NotBlank(message = "图书编号不能为空")
    private Long bookId;
    /**
     * 读者编号
     */
    @NotBlank(message = "读者编号不能为空")
    private Long readerId;
    /**
     * 借阅时间
     */
    @Past
    private LocalDateTime borrowDate;
    /**
     * 应还日期
     */
    private LocalDateTime dueDate;
    /**
     * 实际归还日期，DATETIME类型，可为NULL（未归还时为NULL）
     */
    private LocalDateTime returnDate;
    /**
     * 0-借出中, 1-已归还, 2-逾期, 3-丢失
     */
    @Max(value = 4, message = "状态值不能大于3")
    @Min(value = 0, message = "状态值不能小于0")
    private Integer status;
    /**
     * 续借次数
     */
    private Integer renewCount;
    /**
     * 操作员ID
     */
    private Integer operatorId;
    /**
     * 逾期天数
     */
    private Long overdueDays;
    /**
     * 备注
     */
    private String notes;
}
